MessageForm = Ext.extend(Ext.Panel, {
	formPanel : null,
	constructor : function(a) {
		Ext.applyIf(this, a);
		this.initUIComponents();
		MessageForm.superclass.constructor.call(this, {
					id : "MessageForm",
					layout : "form",
					border : false,
					items : [this.formPanel]
				});
	},
	initUIComponents : function() {
		this.formPanel = new Ext.FormPanel({
			id : "mFormPanel",
			title : "发送信息",
			iconCls : "btn-sendM",
			frame : true,
			draggable : true,
			border : false,
			style : "margin-top:10%;margin-left:20%;",
			width : 460,
			height : 260,
			defaultType : "textarea",
			url : __ctxPath + "/info/sendShortMessage.do",
			method : "post",
			reader : new Ext.data.JsonReader({
						root : "data",
						id : "messageId"
					}, [{
								name : "userId",
								mapping : "senderId"
							}, {
								name : "userFullname",
								mapping : "sender"
							}]),
			defaults : {
				allowBlank : false,
				selectOnFocus : true,
				msgTarget : "side"
			},
			modal : true,
			layout : "form",
			plain : true,
			scope : this,
			buttonAlign : "center",
			items : [{
						xtype : "hidden",
						name : "userId",
						id : "userId"
					}, {
						xtype : "fieldset",
						style : "padding:0px",
						border : false,
						hight : 70,
						layout : "column",
						items : [{
									xtype : "label",
									text : "收信人:",
									width : 50
								}, {
									xtype : "textarea",
									name : "userFullname",
									id : "userFullname",
									allowBlank : false,
									readOnly : true,
									width : 290,
									height : 50
								}, {
									xtype : "container",
									border : true,
									width : 100,
									heigth : 30,
									items : [{
										xtype : "button",
										iconCls : "btn-mail_recipient",
										text : "添加联系人 ",
										width : 80,
										handler : function() {
											UserSelector.getView(
													function(h, f) {
														var c = Ext
																.getCmp("userId");
														var b = Ext
																.getCmp("userFullname");
														if (c.getValue() != ""
																&& b.getValue() != "") {
															var e = (c
																	.getValue() + ",")
																	.concat(h);
															var a = (b
																	.getValue() + ",")
																	.concat(f);
															var d = uniqueArray(e
																	.split(","));
															var g = uniqueArray(a
																	.split(","));
															c
																	.setValue(d
																			.toString());
															b
																	.setValue(g
																			.toString());
														} else {
															c.setValue(h);
															b.setValue(f);
														}
													}).show();
										}
									}, {
										xtype : "button",
										text : "清除联系人",
										iconCls : "btn-del",
										width : 80,
										handler : function() {
											var a = Ext.getCmp("userFullname");
											var b = Ext.getCmp("userId");
											a.reset();
											b.reset();
										}
									}]
								}]
					}, {
						xtype : "fieldset",
						border : false,
						style : "padding:0px",
						layout : "column",
						height : 140,
						items : [{
									xtype : "label",
									text : "内容:",
									width : 50
								}, {
									id : "sendContent",
									xtype : "textarea",
									name : "content",
									width : 380,
									height : 120,
									autoScroll : true,
									allowBlank : false
								}]
					}],
			buttons : [{
						text : "发送",
						iconCls : "btn-mail_send",
						handler : this.send
					}, {
						text : "重置",
						iconCls : "reset",
						handler : this.reset
					}]
		});
	},
	send : function() {
		var a = Ext.getCmp("mFormPanel");
		if (a.getForm().isValid()) {
			a.getForm().submit({
						waitMsg : "正在 发送信息",
						success : function(b, c) {
							var b = Ext.getCmp("mFormPanel");
							Ext.ux.Toast.msg("操作信息", "信息发送成功！");
							b.getForm().reset();
						}
					});
		}
	},
	reset : function() {
		var a = Ext.getCmp("mFormPanel");
		a.getForm().reset();
	}
});